|
In computer programming, leaning toothpick syndrome (LTS) is the situation in which a quoted expression becomes unreadable because it contains a large number of escape characters, usually backslashes ("\"), to avoid delimiter collision. The official Perl documentation〔(perlop - perldoc.perl.org )〕 introduced the term to wider usage; there, the phrase is used to describe regular expressions that match Unix-style paths in which the elements are separated by slashes / . The slash is also used as the default regular expression delimiter which must be escaped with a ''back''slash, \ , leading to frequent escaped slashes represented as \/ . If doubled, as in URLs, this yields \/\/ for an escaped // . A similar phenomenon occurs for DOS/Windows paths, where the backslash is used as a path separator, requiring a doubled backslash \\ – this can then be ''re''-escaped for a regular expression inside an escaped string, requiring \\\\ to match a single backslash. In extreme cases, such as a regular expression in escaped string, matching a Uniform Naming Convention path (which begins \\ ) this requires 8 backslashes \\\\\\\\ due to 2 backslashes each being double-escaped.LTS appears in many programming languages and in many situations, including in patterns that match Uniform Resource Identifiers (URIs) and in programs that output quoted text. Many quines fall into the latter category. ==Pattern example== Consider the following Perl regular expression intended to match URIs which identify files under the pub directory of an FTP site:Perl, like sed before it, solves this problem by allowing many other characters to be delimiters for a regular expression. For example, the following three examples are equivalent to the expression given above: 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Leaning toothpick syndrome」の詳細全文を読む スポンサード リンク
|